{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Statistics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "__author__ = \"kyubyong. kbpark.linguist@gmail.com\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'1.11.3'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.__version__"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Order statistics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Q1. Return the minimum value of x along the second axis."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "x=\n",
      " [[0 1]\n",
      " [2 3]]\n",
      "ans=\n",
      " [0 2]\n"
     ]
    }
   ],
   "source": [
    "x = np.arange(4).reshape((2, 2))\n",
    "print(\"x=\\n\", x)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Q2. Return the maximum value of x along the second axis. Reduce the second axis to the dimension with size one."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "x=\n",
      " [[0 1]\n",
      " [2 3]]\n",
      "ans=\n",
      " [[1]\n",
      " [3]]\n"
     ]
    }
   ],
   "source": [
    "x = np.arange(4).reshape((2, 2))\n",
    "print(\"x=\\n\", x)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Q3. Calcuate the difference between the maximum and the minimum of x along the second axis."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "x=\n",
      " [[0 1 2 3 4]\n",
      " [5 6 7 8 9]]\n",
      "ans=\n",
      " [4 4]\n"
     ]
    }
   ],
   "source": [
    "x = np.arange(10).reshape((2, 5))\n",
    "print(\"x=\\n\", x)\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Q4. Compute the 75th percentile of x along the second axis."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "x=\n",
      " [[ 1  2  3  4  5]\n",
      " [ 6  7  8  9 10]]\n",
      "ans=\n",
      " [ 4.  9.]\n"
     ]
    }
   ],
   "source": [
    "x = np.arange(1, 11).reshape((2, 5))\n",
    "print(\"x=\\n\", x)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Averages and variances"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Q5. Compute the median of flattened x."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "x=\n",
      " [[1 2 3]\n",
      " [4 5 6]\n",
      " [7 8 9]]\n",
      "ans=\n",
      " 5.0\n"
     ]
    }
   ],
   "source": [
    "x = np.arange(1, 10).reshape((3, 3))\n",
    "print(\"x=\\n\", x)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Q6. Compute the weighted average of x."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2.66666666667\n"
     ]
    }
   ],
   "source": [
    "x = np.arange(5)\n",
    "weights = np.arange(1, 6)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Q7. Compute the mean, standard deviation, and variance of x along the second axis."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "x=\n",
      " [0 1 2 3 4]\n",
      "mean=\n",
      " 2.0\n",
      "std=\n",
      " 1.41421356237\n",
      "variance=\n",
      " 2.0\n"
     ]
    }
   ],
   "source": [
    "x = np.arange(5)\n",
    "print(\"x=\\n\",x)\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Correlating"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Q8. Compute the covariance matrix of x and y."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ans=\n",
      " [[ 1. -1.]\n",
      " [-1.  1.]]\n"
     ]
    }
   ],
   "source": [
    "x = np.array([0, 1, 2])\n",
    "y = np.array([2, 1, 0])\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Q9. In the above covariance matrix, what does the -1 mean?"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Q10. Compute Pearson product-moment correlation coefficients of x and y."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ans=\n",
      " [[ 1.          0.92857143]\n",
      " [ 0.92857143  1.        ]]\n"
     ]
    }
   ],
   "source": [
    "x = np.array([0, 1, 3])\n",
    "y = np.array([2, 4, 5])\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Q11. Compute cross-correlation of x and y."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ans=\n",
      " [19]\n"
     ]
    }
   ],
   "source": [
    "x = np.array([0, 1, 3])\n",
    "y = np.array([2, 4, 5])\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Histograms"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Q12. Compute the histogram of x against the bins."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ans=\n",
      " (array([2, 3, 1], dtype=int64), array([0, 1, 2, 3]))\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgsAAAFkCAYAAACuFXjcAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAFVpJREFUeJzt3X+s5WWdH/D3h+XHKCljUsoMNKRUVlmsKbMzbhURB8sP\nF0wwq2Z3b6XOojUiJksnbd2Yhmy6TSWE4MhqCTZkV4juTTdtzRJjhQXLEiqElBFJFJwmQEWBgdV2\ncEWoDk//OGfo5Xrvc+d77p1z78x9vZJvZr7PeZ7zfe4zz5z7Pt+f1VoLAMBijlrtDgAAa5uwAAB0\nCQsAQJewAAB0CQsAQJewAAB0CQsAQJewAAB0CQsAQJewAAB0DQoLVXVFVX27qvaNl29W1W8u0ea8\nqnqwql6sqj1VtWN5XQYApmnonoUnk/xBkq1JtiX5RpK/qKozF6pcVacl+WqSu5KcleSGJDdX1YUT\n9hcAmLJa7oOkqupHSf5la+1PF3jt2iQXt9b+4Zyy2SQbW2uXLGvDAMBUTHzOQlUdVVW/m+S1Se5b\npNrbktw5r+z2JGdPul0AYLqOHtqgqt6cUTjYk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oRf3za0/1n0Q1ZFmwnFbyJaM\nduOxsHU/11bQuptr4196703yrtba9w+iybqfbxOM2ULW3VxbwFFJFjuksDLzbBXO2vztJC8k+VCS\nX0vyhYzO5Pw749evSXLLnPqnJflJRmd0npHR5Vz/N8kFq30G6hoft6uSXJrk9CT/IKPjgT/PKL2v\n+s8zpTE7PqNddVsyOsv6n4/XTzXXVnTczLXRbvT/ndHlgJvmLBvm1Pm0+bbsMTPXRmNybpK/l+TN\n4/+Pv0jyj8evH5LPtdX6Ya9M8kSSn2WUbt4y57U/TfKNefXfmdE3658l+Z9J/ulq/4Ot9XFL8q/G\nY/XTJM9ldCXFO1f7Z5jyeG0f/7LbP2/5E3Nt5cbNXHvlEtP547U/yYfm1DHfljlm5lpLkpuTPDae\nM88kueNAUDiU88yDpACALs+GAAC6hAUAoEtYAAC6hAUAoEtYAAC6hAUAoEtYAAC6hAUAoEtYAAC6\nhAUAoEtYAAC6/h+sRyodSeNw6wAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0xa3faa891d0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.array([0.5, 0.7, 1.0, 1.2, 1.3, 2.1])\n",
    "bins = np.array([0, 1, 2, 3])\n",
    "print(\"ans=\\n\", ...)\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "plt.hist(x, bins=bins)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Q13. Compute the 2d histogram of x and y."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 127,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ans=\n",
      " [[ 3.  0.  0.  0.]\n",
      " [ 0.  2.  0.  0.]\n",
      " [ 0.  0.  1.  1.]]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAhcAAAFk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ata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "xedges = [0, 1, 2, 3]\n",
    "yedges = [0, 1, 2, 3, 4]\n",
    "x = np.array([0, 0.1, 0.2, 1., 1.1, 2., 2.1])\n",
    "y = np.array([0, 0.1, 0.2, 1., 1.1, 2., 3.3])\n",
    "...\n",
    "\n",
    "plt.scatter(x, y)\n",
    "plt.grid()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Q14. Count number of occurrences of 0 through 7 in x."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 129,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ans=\n",
      " [1 3 1 1 0 0 0 1]\n"
     ]
    }
   ],
   "source": [
    "x = np.array([0, 1, 1, 3, 2, 1, 7])\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Q15. Return the indices of the bins to which each value in x belongs."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 130,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ans=\n",
      " [1 4 3 2]\n"
     ]
    }
   ],
   "source": [
    "x = np.array([0.2, 6.4, 3.0, 1.6])\n",
    "bins = np.array([0.0, 1.0, 2.5, 4.0, 10.0])\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [conda root]",
   "language": "python",
   "name": "conda-root-py"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
